#!/bin/bash
cyan='\033[0;36m'
green='\033[0;32m'
lightgreen='\e[0;32m'
white='\e[0;37m'
red='\e[0;31m'
yellow='\033[0;33m'
blue='\033[0;34m'
orange='\e[38;5;166m'

echo -e "$orange""---------$green TheFatRat tools version check$orange----------"
echo -e "$orange""-------------------------------------------------"

echo -ne "$green""* - Checking$cyan Netcat$green (Net Check)..............."
which nc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install netcat"
fi
echo -ne "$green""* - Checking$cyan Xterm$green (Terminal)................."
which xterm > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install xterm"
fi
echo -ne "$green""* - Checking$cyan Dig$green (Dns-Util)..................."
which dig > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install dnsutils"
fi
echo -ne "$green""* - Checking$cyan mono-mcs$green (compiler).............."
which mcs > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install mono-mcs mono-devel"
fi
echo -ne "$green""* - Checking$cyan Gcc$green (compiler)..................."
which gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install gcc"
fi
echo -ne "$green""* - Checking$cyan Apache2$green (Web Server)............."
which apache2 > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install apache2"
fi
echo -ne "$green""* - Checking$cyan Gnome Terminal$green (Terminal)........"
which gnome-terminal > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install gnome-terminal"
fi
echo -ne "$green""* - Checking$cyan Upx$green (File Compressor)............"
which upx > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install upx-ucl"
fi
echo -ne "$green""* - Checking$cyan Ruby$green (Programming)..............."
which ruby > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install ruby"
fi
echo -ne "$green""* - Checking$cyan Gem$green (Ruby modules installer)....."
which gem > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
echo -ne "$green""* - Checking$cyan nokogiri$green (Ruby module)..........."
chkvs=$(gem list | grep "nokogiri")
if [[ ! -z "$chkvs" ]]
then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green gem install nokogiri"
fi
else
echo -e "$green""[${red}x$green]$orange Solution:$green https://rubygems.org/pages/download"
fi
echo -ne "$green""* - Checking$cyan Openssl$green (Certificates)..........."
which openssl > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install openssl"
fi
echo -ne "$green""* - Checking$cyan Python2$green (Programming)............"
which python2 > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install python2-minimal"
fi
echo -ne "$green""* - Checking$cyan Python3$green (Programming)............"
which python3 > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install python3"
fi
echo -ne "$green""* - Checking$cyan Python-pip3$green (Module Installer)..."
which pip3 > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
echo -ne "$green""* - Checking$cyan names$green (python module)............"
chkvs=$(pip3 list | grep "names")
if [[ ! -z "$chkvs" ]]
then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green pip3 install names"
fi
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install python3-pip"
fi
echo -ne "$green""* - Checking$cyan Build-Essential$green (Cross Compiler)."
chkvs=$(apt-cache policy build-essential | grep "Installed" | awk '{print$2}')
if [[ "$chkvs" == "(none)" ]]
then
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install build-essential"
else
echo "[✔]"
fi
echo -ne "$green""* - Checking$cyan lib32z1$green (apk Req.)..............."
chkvs=$(apt-cache policy lib32z1 | grep "Installed" | awk '{print$2}')
if [[ "$chkvs" == "(none)" ]]
then
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install lib32z1"
else
echo "[✔]"
fi

echo -ne "$green""* - Checking$cyan lib32ncurses5$green (apk Req.)........."
chkvs=$(apt-cache policy lib32ncurses5 | grep "Installed" | awk '{print$2}')
if [[ "$chkvs" == "(none)" ]]
then
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install lib32ncurses5"
else
echo "[✔]"
fi
echo -ne "$green""* - Checking$cyan lib32stdc++6$green (apk Req.).........."
chkvs=$(apt-cache policy lib32stdc++6 | grep "Installed" | awk '{print$2}')
if [[ "$chkvs" == "(none)" ]]
then
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install lib32stdc++6"
else
echo "[✔]"
fi
echo -ne "$green""* - Checking$cyan Jarsigner$green (apk Req.)............."
which jarsigner > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
echo -ne "$green""* - Checking$cyan Keytool$green (apk Req.)..............."
which keytool > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install default-jdk default-jre"
fi
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install default-jdk default-jre"
fi
echo -ne "$green""* - Checking$cyan Unzip$green (Unpacker)................."
which unzip > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install unzip"
fi
echo -ne "$green""* - Checking$cyan Zipalign$green (Apk Req.).............."
if [ -f "tools/android-sdk/zipalign" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green Clone Fatrat Git again to a different directory"
echo -e "$orange""zipalign was not found in fatrat package"
fi
echo -ne "$green""* - Checking$cyan Mingw 64 Bit$green (Compiler).........."
which x86_64-w64-mingw32-gcc >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
chkvs=$(x86_64-w64-mingw32-gcc --version | sed -n 1p | awk '{print$3}')
case $chkvs in
4.9.1)
echo "[✔]"
;;
6.3.0)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect 64Bit Version for Fudwin in Fatrat"
echo ""
echo -e "$orange""------------Solution -------------"
echo -e "$cyan""Step 1 - Remove your current ming installation"
echo ""
echo -e "$green""apt-get remove --purge *mingw* -y && apt-get autoremove -y"
echo ""
echo -e "$cyan""Step 2 - Run Setup from fatrat"
echo ""
echo -e "$green""chmod +x setup.sh && ./setup.sh"
echo -e "$orange""----------------------------------"
echo ""
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo ""
echo -e "$orange""------------Solution -------------"
echo -e "$cyan""Step 1 - Run Setup from fatrat"
echo ""
echo -e "$green""chmod +x setup.sh && ./setup.sh"
echo ""
echo -e "$orange""----------------------------------"
fi
echo -ne "$green""* - Checking$cyan Mingw 32 Bit$green (Compiler).........."
which i686-w64-mingw32-gcc >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
chkvs=$(i686-w64-mingw32-gcc --version | sed -n 1p | awk '{print$3}')
case $chkvs in
4.9.1)
echo "[✔]"
;;
6.3.0)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect 64Bit Version for Fudwin in Fatrat"
echo ""
echo -e "$orange""------------Solution -------------"
echo -e "$cyan""Step 1 - Remove your current ming installation"
echo ""
echo -e "$green""apt-get remove --purge *mingw* -y && apt-get autoremove -y"
echo ""
echo -e "$cyan""Step 2 - Run Setup from fatrat"
echo ""
echo -e "$green""chmod +x setup.sh && ./setup.sh"
echo -e "$orange""----------------------------------"
echo ""
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo ""
echo -e "$orange""------------Solution -------------"
echo -e "$cyan""Step 1 - Run setup from fatrat"
echo ""
echo -e "$green""chmod +x setup.sh && ./setup.sh"
echo -e "$orange""----------------------------------"
echo ""
echo ""
fi
rm -rf temp/dx >/dev/null 2>&1
echo -ne "$green""* - Checking$cyan Dx$green (Apk Req.)...................."
which dx >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
dxg=$(dx --version  2>&1 | tee temp/dx > /dev/null 2>&1)
chkvs=$(grep "version" < temp/dx | awk '{print $3}') 
case "$chkvs" in
1.16)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect Version for apk builder in Fatrat"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Remove your current install dx version"
echo ""
echo -e "$green""apt-get remove --purge dx"
echo ""
echo -e "$cyan""Step 2 - Run setup.sh from fatrat and let it install the correct version"
echo -e "$orange""----------------------------------"
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Run setup.sh from fatrat and let it install the tool"
echo -e "$orange""----------------------------------"
fi
rm -f temp/dx >/dev/null 2>&1
echo -ne "$green""* - Checking$cyan Aapt$green (Apk Req.).................."
which aapt >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
chkvs=$(aapt v | grep "Android" | awk '{print $5}') 
case "$chkvs" in
v0.2-6625208)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect Version for apk builder in Fatrat"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Remove your current installed aapt version"
echo ""
echo -e "$green""apt-get remove --purge aapt"
echo ""
echo -e "$cyan""Step 2 - Run setup.sh from fatrat and let it install the correct version"
echo -e "$orange""----------------------------------"
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Run setup.sh from fatrat and let it install the tool"
echo -e "$orange""----------------------------------"
fi
echo -ne "$green""* - Checking$cyan Apktool$green (Apk Req.)..............."
which apktool >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
chkvs=$(apktool --version | awk '{print$1}') 
case "$chkvs" in
2.6.0)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect Version for apk builder in Fatrat"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Remove your current installed apktool version"
echo ""
echo -e "$green""apt-get remove --purge apktool -y && rm /usr/local/sbin/apktool > /dev/null 2>&1"
echo ""

echo -e "$cyan""Step 2 - Run setup.sh from fatrat and let it install the correct version"
echo -e "$orange""----------------------------------"
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Run setup.sh from fatrat and let it install the tool"
echo -e "$orange""----------------------------------"
fi
echo -ne "$green""* - Checking$cyan Baksmali$green (Apk Req.).............."
which baksmali >> /dev/null 2>&1
if [ "$?" -eq "0" ]; then
chkvs=$(baksmali --version | grep "baksmali" | awk '{print$2}') 
case "$chkvs" in
2.3.3)
echo "[✔]"
;;
*)
echo -e "$green""[${red}x$green]$orange Incorrect Version for apk builder in Fatrat"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Remove your current installed baksmali version"
echo ""
echo -e "$green""apt-get remove --purge smali"
echo ""
echo -e "$cyan""Step 2 - Run setup.sh from fatrat and let it install the correct version"
echo -e "$orange""----------------------------------"
;;
esac
else
echo -e "$green""[${red}x$green]$orange Not Found"
echo -e "$orange""------------Solution-------------"
echo -e "$cyan""Step 1 - Run setup.sh from fatrat and let it install the tool"
echo -e "$orange""----------------------------------"
fi
echo -ne "$green""* - Checking$cyan Metasploit-Framework$green (msfc)......"
which msfconsole > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install metasploit-framework"
echo -e "$orange""Install using kali repository"
fi
echo -ne "$green""* - Checking$cyan Metasploit-Framework$green (msfv)......"
which msfvenom > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install metasploit-framework"
echo -e "$orange""Install using kali repository"
fi
echo -ne "$green""* - Checking$cyan Backdoor Factory$green (exe backdoor).."
which backdoor-factory > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install backdoor-factory"
echo -e "$orange""Install using kali repository/Ignore in case manually installed"
fi
echo -ne "$green""* - Checking$cyan Searchsploit$green (exploit db)........"
which searchsploit > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "[✔]"
else
echo -e "$green""[${red}x$green]$orange Solution:$green apt-get install exploitdb"
echo -e "$orange""Install using kali repository/Ignore in case manually installed"
fi
echo ""
echo -e "$orange""--------------End Of Check tool for fatrat---------------"
exit 0
